package jmu.edu.yjc.domain.entity.neo4j.NodeEntity;

import io.swagger.annotations.ApiModel;
import jmu.edu.yjc.domain.entity.neo4j.RelationEntity.DepartmentRel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.neo4j.core.schema.*;

import java.util.Objects;

@Node("department")
@Data
@ApiModel("医疗科目")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Department {
    @Id
    @GeneratedValue
    private Long id;
    @Property("name")
    private String name;
    @Relationship(type = "departmentRel", direction = Relationship.Direction.OUTGOING)
    private DepartmentRel departmentRel;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Department)) return false;
        Department that = (Department) o;
        return Objects.equals(name, that.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }
}
